﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Praxis.Entities;
using Praxis.BusinessLogic;
using Microsoft.Practices.Unity;

namespace Praxis.UI
{
    public partial class FrmAlquiler : Form
    {

        [Dependency]
        public IAlquilerBL alquilerBL { get; set; }

        public FrmAlquiler()
        {
            InitializeComponent();
            this.BuildUp();
        }

        private void BtnNuevo_Click(object sender, EventArgs e)
        {
            FrmMttoAlquiler frm = new FrmMttoAlquiler();
            frm.Show();
            this.Hide();
        }

        private void FrmAlquiler_Load(object sender, EventArgs e)
        {
            aLQUILERBindingSource.DataSource = alquilerBL.GetAllAlquiler();
            aLQUILERBindingSource.AddNew();
        }

        public ALQUILER CurrentAlquiler { get; set; }

        private void aLQUILERDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            CurrentAlquiler = aLQUILERBindingSource.Current as ALQUILER;
        }

        private void aLQUILERDataGridView_DoubleClick(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
